<div class="actions" style="width: 400px;">
    <?php echo $this->Html->link(__(LANG_COUPONCREATE), array('action' => 'coupon_created'))?>
    <?php echo $this->Html->link(__(LANG_COUPONLIST), array('action' => 'coupon_list'))?>
    <?php echo $this->Html->link(__('EXCEL다운로드'), array('action' => 'coupon_export_excel'))?>    
</div>

<table>
    <tr>
        <th><?php echo (__(LANG_COUPON_ID)); ?></th>
        <th><?php echo $this->Paginator->sort('agent', __(LANG_COUPON_AGENT)); ?></th>
        <th><?php echo $this->Paginator->sort('use_limit', __(LANG_COUPON_USE_LIMIT)); ?></th>
        <th><?php echo $this->Paginator->sort('count', __(LANG_COUPON_COUNT)); ?></th>
        <th><?php echo $this->Paginator->sort('start_time', __(LANG_COUPON_STARTTIME)); ?></th>
        <th><?php echo $this->Paginator->sort('end_time', __(LANG_COUPON_ENDTIME)); ?></th>
        <th><?php echo (__(LANG_COUPON_REWARD)); ?></th>
    </tr>
    <?php foreach ($data as $value): ?>
        <tr>
            <td><?php echo ($value['CouponList']['coupon_id']); ?> </td>
            <td><?php echo ($value['CouponList']['agent']); ?> </td>
            <td><?php echo ($value['CouponList']['use_limit']); ?> </td>
            <td><?php echo ($value['CouponList']['count']); ?> </td>
            <td><?php echo ($value['CouponList']['start_time']); ?> </td>
            <td><?php echo ($value['CouponList']['end_time']); ?> </td>

            <?php
            $reward_data = [];
            foreach($value['CouponList']['reward'] as $num => $reward)
            {
                $reward_data[$reward['reward_id']] = $reward['count'];
            }
            ?>

            <td><?php echo (json_encode($reward_data)); ?> </td>
        </tr>
    <?php endforeach; ?>
</table>
<?php
echo $this->Paginator->prev('««« ', null, null, array('class' => 'disabled'));
echo $this->Paginator->numbers();
echo $this->Paginator->next(' »»»', null, null, array('class' => 'disabled'));
echo $this->Paginator->counter();
?>
